package com.ruoyi.points.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.points.mapper.VideoPointsLogsMapper;
import com.ruoyi.points.domain.VideoPointsLogs;
import com.ruoyi.points.service.IVideoPointsLogsService;

/**
 * 积分日志Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-05-10
 */
@Service
public class VideoPointsLogsServiceImpl implements IVideoPointsLogsService 
{
    @Autowired
    private VideoPointsLogsMapper videoPointsLogsMapper;

    /**
     * 查询积分日志
     * 
     * @param id 积分日志主键
     * @return 积分日志
     */
    @Override
    public VideoPointsLogs selectVideoPointsLogsById(Long id)
    {
        return videoPointsLogsMapper.selectVideoPointsLogsById(id);
    }

    /**
     * 查询积分日志列表
     * 
     * @param videoPointsLogs 积分日志
     * @return 积分日志
     */
    @Override
    public List<VideoPointsLogs> selectVideoPointsLogsList(VideoPointsLogs videoPointsLogs)
    {
        return videoPointsLogsMapper.selectVideoPointsLogsList(videoPointsLogs);
    }

    /**
     * 新增积分日志
     * 
     * @param videoPointsLogs 积分日志
     * @return 结果
     */
    @Override
    public int insertVideoPointsLogs(VideoPointsLogs videoPointsLogs)
    {
        videoPointsLogs.setCreateTime(DateUtils.getNowDate());
        return videoPointsLogsMapper.insertVideoPointsLogs(videoPointsLogs);
    }

    public int addVideoPointsLogs(Long userId, Long points, String notes) {
        VideoPointsLogs videoPointsLogs = new VideoPointsLogs();
        videoPointsLogs.setUserId(userId);
        videoPointsLogs.setNotes(notes);
        videoPointsLogs.setPoints(points);
        videoPointsLogs.setCreateTime(new Date());
        return insertVideoPointsLogs(videoPointsLogs);
    }

    /**
     * 修改积分日志
     * 
     * @param videoPointsLogs 积分日志
     * @return 结果
     */
    @Override
    public int updateVideoPointsLogs(VideoPointsLogs videoPointsLogs)
    {
        return videoPointsLogsMapper.updateVideoPointsLogs(videoPointsLogs);
    }

    /**
     * 批量删除积分日志
     * 
     * @param ids 需要删除的积分日志主键
     * @return 结果
     */
    @Override
    public int deleteVideoPointsLogsByIds(Long[] ids)
    {
        return videoPointsLogsMapper.deleteVideoPointsLogsByIds(ids);
    }

    /**
     * 删除积分日志信息
     * 
     * @param id 积分日志主键
     * @return 结果
     */
    @Override
    public int deleteVideoPointsLogsById(Long id)
    {
        return videoPointsLogsMapper.deleteVideoPointsLogsById(id);
    }
}
